package thread;


public class ThreadDemo3
{
    public static void main(String[] args)
    {
        Thread t1 = new Thread()
        {
            @Override
            public void run()
            {
                Thread.currentThread().setName("t1");
                for (int i = 0; i < 100; i++)
                {
                    System.out.println("i = " + i + "    "+ Thread.currentThread().getName());
                }
            }
        };
        Runnable r1 = new Runnable()
        {
            @Override
            public void run()
            {
                System.out.println("0000000000");
            }
        };
        // lambda表达式创建      接口只有一个方法 才可以这么写
        // 白石山  -> 太行之首
        Runnable r2 = ()->
        {
            for (int i = 0 ; i < 1000  ; i++)
            {
                System.out.println(".........");
            }
        };
        Thread t2 = new Thread(r1);

        t1.start();
        t2.start();
    }
}



